package ar.uba.fi.tp2Unit.framework;


/**
 * It represents the result of the execution of a {@link TestCase}.
 * It collects the name of the test case, the name of the {@link TestSuite}
 * where it belongs, resulting message from the assertion and the type of
 * result it is.
 * 
 * @author grupo12
 */
public class TestResultDescription {

	public enum TestResultType {
	    OK, FAIL, ERROR 
	}
	
	private String testCaseName;
	private String testSuiteName;
	private String message;
	private TestResultType type;
	private String testElapsedTime;

	public TestResultDescription(String testCaseName, String testSuiteName, String message, TestResultType type, String testElapsedTime) {
		super();
		this.testCaseName = testCaseName;
		this.testSuiteName = testSuiteName;
		this.type = type;
		this.message = message;
		this.testElapsedTime = testElapsedTime;
	}
	
	public String getTestCaseName() {
		return testCaseName;
	}

	public String getTestSuiteName() {
		return testSuiteName;
	}

	public String getMessage() {
		return message;
	}

	public String getType() {
		return type.name();
	}
	
	public String getElapsedTime() {
		return testElapsedTime;
	}	
	
	public String toString(){
		return String.format("[%s] %s(%ss): %s", getType(), getTestCaseName(), getElapsedTime(), getMessage());
	}
	
	public String toShowableString(){
		return String.format("%s.%s(%ss): %s", getTestSuiteName(), getTestCaseName(), getElapsedTime(), getMessage());
	}

	public void setTestSuiteName(String name) {
		this.testSuiteName = name;
		
	}
}
